<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>找回密码 - 【少儿编程教学平台】</title>
    <link rel="icon" href="/img/logo.png">
    <link rel="stylesheet" type="text/css" href="/css/sFind-teacher.css">
    <script type="text/javascript" src="/js/jquery-3.4.1.min.js"></script>

</head>
<body>

<div class="headerpage"></div>

<div class="wrap">
    <div class="content">
        <div class="content-center">
            <div class="center-title">
                <h2>找回密码</h2>
            </div>
            <div class="center-content">
                <form>


                    <label class="tou">手机号码</label><br>
                    <div class="kuang">
                        <input class="number" type="password" name="password" placeholder="请输入手机号码">
                    </div>
                    <br>

                    <label class="tou">新密码</label><br>
                    <div class="kuang">
                        <input class="number" type="password" name="newPassword" placeholder="请输入新密码">
                    </div>
                    <br>

                    <label class="tou">确认新密码</label><br>
                    <div class="kuang">
                        <input class="number" type="password" name="cNewPassword" placeholder="确认新密码">
                    </div>
                    <br>


                    <button type="button" class="btn-update">确定</button>


                </form>
            </div>
        </div>
    </div>
</div>

<div class="footerpage"></div>

<script type="text/javascript">

    $(function () {

        $(".headerpage").load("header.jsp");
        $(".footerpage").load("footer.jsp");

        $("button").click(function () {

            var val1 = false, val2 = false;

            var reg = /^[0-9A-z$]{6,16}$/;

            if (reg.test($("[name='newPassword']")[0].value)) {
                /* $(".kuang").css("border","1px solid red"); */
            } else {
                $("[name='newPassword']").css("border", "1px solid red");
                console.log("1");
            }


            $.ajax({

                type: 'post',

                url: 'findPasswordTeacher.action',

                data: {
                    "sphone": $("input")[0].value,
                    "spassword": $("input")[1].value
                },

                contentType: "application/x-www-form-urlencoded",

                dataType: 'json',

                success: function (data) {

                    alert("修改成功");
                    console.log("请求成功");
                    console.log(data);


                },

                error: function (data) {
                    console.log("请求失败");
                }


            })
        })
    })
</script>


</body>
</html>